$(function () {
    function b(a) {
        "true" == GUANGER.login && (window.location.href = GUANGER.path + "/snsLogin?snsType=" + a)
    }

    var f = [
        {referer:"qq", snsType:"4"},
        {referer:"weibo", snsType:"3"},
        {referer:"taobao", snsType:"8"},
        {referer:"alipay", snsType:"9"}
    ], a = function (a, b) {
        if (!$(".guide")[0]) {
            var c = $.grep(f, function (g) {
                return g.referer != a
            }), d = "";
            $.map(c, function (a) {
                d += '<li><a target="_blank" class="shortcut-login-' + a.referer + '" href="http://guang.com/snsLogin?snsType=' + a.snsType + '&backType=1">' + a.referer + "</a></li>"
            });
            $("body").append('<div class="guide guide-' + a + '"><div class="guide_boby"><p><i></i>\u767b\u5f55 Guang.com \uff0c\u53d1\u73b0\u4f60\u7684\u559c\u6b22\uff01<span><a href="/signup">\u6ce8\u518c\u901b\u5e10\u53f7 ></a></span></p><div class="guide_add"><a id="J_RefererLogin" class="referer-login" target="_blank" href="http://guang.com/snsLogin?snsType=' + b + '&backType=1">' + a + '</a><div class="favorites" id="J_Favorites"><a href="javascript:void(0);">\u52a0\u5165\u6536\u85cf\u5939</a></div><ul class="other-login">' +
                d + '</ul></div><div class="del" id="J_CloseGuide"><a href="javascript:void(0);">\u5173\u95ed\u5f15\u5bfc</a></div></div></div>');
            $("#J_Favorites").click(function () {
                window.sidebar ? window.sidebar.addPanel("\u901b\uff0c\u53d1\u73b0\u559c\u6b22", "http://guang.com", "") : window.external && document.all ? window.external.AddFavorite("http://guang.com", "\u901b\uff0c\u53d1\u73b0\u559c\u6b22") : window.opera || (jQuery.guang.tip.conf.tipClass = "tipmodal tipmodal-error2", jQuery.guang.tip.show($(this), "\u60a8\u7684\u6d4f\u89c8\u5668\u4e0d\u652f\u6301\u81ea\u52a8\u52a0\u6536\u85cf\uff0c\u8bf7\u6309 ctrl+d \u52a0\u5165\u6536\u85cf\u3002"))
            });
            $("#J_CloseGuide").click(function () {
                $(".guide").hide()
            });
            $("#J_RefererLogin, .other-login a").unbind("click").click(function () {
                var a = $(this).attr("href");
                $.guang.util.openWin(a);
                return!1
            })
        }
        var c = function () {
            if (jQuery.guang.util.isIE6()) {
                var a = $(window).height() - 90;
                $(".guide").css({position:"absolute", top:a}).show();
                $(window).bind("scroll", function () {
                    var b = $(document).scrollTop();
                    $.guang.util.isIE6() && $(".guide").css("top", b + a + "px")
                })
            } else $(".guide").show().animate({bottom:0}, 500)
        }, e = window.location.href;
        -1 == e.indexOf("/login") && (-1 == e.indexOf("/doEmailLogin") && -1 == e.indexOf("/signup")) && c()
    };
    if ("" == GUANGER.userId && "undefined" != typeof GUANGER.referer)switch (GUANGER.referer) {
        case "guang.com":
            break;
        case "taobao":
            b(8);
            a("taobao", 8);
            break;
        case "alipay":
            b(9);
            a("alipay", 9);
            break;
        case "weibo":
            b(3);
            a("weibo", 3);
            break;
        case "qq":
            b(4);
            a("qq", 4);
            break;
        default:
            a("qq", 4)
    } else 1 < GUANGER.userId.length && location.href.indexOf("xihuan")
});
